package cn.cccyj.spring_security.core;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import java.io.PrintWriter;

@Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        /**
         * 链式调用流程解释
         * 1.使用表单登录
         * 2.并且
         * 3.使用授权配置
         * 4.对于所有的请求
         * 5.都需要认证
         */
        http.formLogin().and().authorizeRequests().anyRequest().authenticated();
    }
}